package com.uinfor.service.impl;

import cn.hutool.core.lang.UUID;
import com.uinfor.service.MessageProvider;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.messaging.Source;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.messaging.MessageChannel;

import javax.annotation.Resource;

//import javax.xml.transform.Source;

/**
 * @descripttion:
 * @Author: WZH
 * @Date :2021/1/28  17:53
 **/
//定义消息的推送管道
@EnableBinding(Source.class)
public class MessageProviderImpl implements MessageProvider {

    @Resource
    private MessageChannel output; //消息发送管道


    @Override
    public String send() {
        String s = UUID.randomUUID().toString();
        output.send(MessageBuilder.withPayload(s).build());
        System.out.println("************:"+s);
        return null;
    }
}
